#include <iostream>
#include <cstdio>

using namespace std;

int n;
int a[20][20];

int main(){
	cin >> n;
	int op = 0;
	int dy[] = {1 , 0 , -1 , 0};
	int dx[] = {0 , 1 , 0 , -1};
	int x = 1,y = 0;
	int an = 1;
	while(an <= n * n){
		x += dx[op];
		y += dy[op];
		if(x > n || y > n || x < 1 || y < 1 || a[x][y] != 0){
			x -= dx[op];
			y -= dy[op];
			op = (op + 1) % 4;
			continue;
		}
		a[x][y] = an++;
	}
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= n;j++){
			printf("%3d",a[i][j]);
		}
		cout << endl;
	}
	return 0;
}
